<?php
include "../../templates/db/db.php";

$select_m=mysql_query('SELECT * FROM messages WHERE `id`='.$_GET['id'].' AND `to`="'.$_SESSION['username'].'"');
$row_m=mysql_fetch_assoc($select_m);

	echo '
    <table border="0" style="border-collapse: collapse; margin-left: 45px;" width="520px">
      <tr style="background-color: #ddd;"><td align="right" style="width: 100px;"><p><b>Тема</b></p></td><td align="left" style="padding-left: 20px;">'.$row_m[topic].'</td></tr>
	  <tr><td colspan="2"><hr /></td></tr>
	  ';
	  
	  echo '
	  <tr style="background-color: #ddd;"><td align="right"><p><b>От </b></p></td><td align="left" style="padding-left: 20px;">'.$row_m[from].'</td></tr>
	  ';
	  
	  echo '
	  <tr><td colspan="2"><hr /></td></tr>
	  <tr style="background-color: #ddd;"><td align="right"><p><b>Изпратено</b></p></td><td align="left" style="padding-left: 20px;">'.date("d-m-Y", $row_m[date]).'</td></tr>
    </table>   
	<h3 style="text-align: center;">Съобщение</h3>
	';
	
	echo '<p style="margin-left: 25px;">'.$row_m['text'].'</p>';
	$upd=mysql_query('UPDATE messages SET unread=0 WHERE id='.$_GET['id'].'');
?>